/*--------------------------------------------------------------------------------*/
#ifndef __ENTITY_MAN__
#define __ENTITY_MAN__
/*--------------------------------------------------------------------------------*/
#include "primitives.h"
#include "object.h"
#include "util.h"
#include "component_entity_2d.h"
#include "input_system.h"
#include "timer.h"
/*--------------------------------------------------------------------------------*/
class ENTITY_MAN : public COMPONENT_ENTITY_2D
{

	// -- PUBLIC

public:

    DECLARE_REF( ENTITY_MAN );

    // .. CONSTRUCTORS

    ENTITY_MAN() : COMPONENT_ENTITY_2D()
    {
    }

    virtual ~ENTITY_MAN()
    {
    }

    // .. METHODS

    VOID ManageInput( const TIMER & timer )
    {
    	if( INPUT_SYSTEM::GetInstance().IsKeyPressed( INPUT_KEY_Q ) )
		{
			SetAngle( GetAngle() - 5.0f * timer.GetSecondCount() );
		}

		if( INPUT_SYSTEM::GetInstance().IsKeyPressed( INPUT_KEY_D ) )
		{
			SetAngle( GetAngle() + 5.0f * timer.GetSecondCount() );
		}

		if( INPUT_SYSTEM::GetInstance().IsKeyPressed( INPUT_KEY_Z ) )
		{
			SetVelocity( GetVelocity() + 200.0f * timer.GetSecondCount() );
		}

		if( INPUT_SYSTEM::GetInstance().IsKeyPressed( INPUT_KEY_S ) )
		{
			SetVelocity( GetVelocity() - 100.0f * timer.GetSecondCount() );
		}

		if( INPUT_SYSTEM::GetInstance().IsKeyPressed( INPUT_KEY_Space ) )
		{
			SetVelocity( 0.0f );
		}

		SetDirection( MATH_GetNormalFromAngle( GetAngle() - MATH_Pi * 0.5f ) );
    }

    virtual VOID Update( const TIMER & timer )
    {
    	ManageInput( timer );
    	
    	if( Velocity > 0 )
    	{
    		SetVelocity( GetVelocity() - 10.0f * timer.GetSecondCount() );
    	}
    	
    	COMPONENT_ENTITY_2D::Update( timer );
    }

    // -- PRIVATE

private :

    // .. ATTRIBUTES

    
};
/*--------------------------------------------------------------------------------*/
#endif
